import org.apache.hadoop.hive.ql.exec.UDF;

public class UrlUDF extends UDF {

    public static String evaluate(String wz){
        if (wz != null && !"".equals(wz)) {
            if (wz.matches("[a-zA-Z]{1,20}")) {
                return "false";
            } else {
                String regex = "^((https?|ftp):\\/\\/)?[\\w]{1,}(?:\\.?[\\w]{1,})+[\\w-_/?&=#%:]*$";
                boolean matches = wz.matches(regex);
                return matches ? "true" : "false";
            }
        } else {
            return "false";
        }
    }

}